#include "qbasepropertyplugin.h"

#include "qbytearrayproperty.h"
#include "qintproperty.h"
#include "qpointproperty.h"
#include "qsizeproperty.h"
#include "qrectproperty.h"
#include "qboolproperty.h"
#include "qfontproperty.h"
#include "qcursorproperty.h"
#include "qstringproperty.h"
#include "qenumproperty.h"
#include "qalignmentproperty.h"
#include "qscriptproperty.h"
#include "qmemerydataproperty.h"
#include "qfloatproperty.h"
#include "qdateproperty.h"
#include "qtimeproperty.h"
#include "qdatetimeproperty.h"
#include "qnameproperty.h"
#include "qstylesheetproperty.h"

#include <qplugin.h>

QBasePropertyPlugin::QBasePropertyPlugin()
{
}

QStringList QBasePropertyPlugin::supportPropertys()
{
    QStringList ret;
    ret<<"ByteArray"<<"Number"<<"Point"<<"Size"<<"Rect"<<"Bool"<<"Font"
      <<"Cursor"<<"String"<<"Enum"<<"Align"<<"Script"<<"Memery"
     <<"Float"<<"Date"<<"Time"<<"DateTime"<<"Name"<<"Stylesheet";
    return ret;
}

QString QBasePropertyPlugin::pluginName()
{
    return "Base.Property.Plugin";
}

SHAREDLIB::QAbstractProperty*   QBasePropertyPlugin::createProperty(const QString &propertyName)
{
    SHAREDLIB::QAbstractProperty* pro=NULL;

    if(propertyName=="ByteArray")
    {
        pro=new QByteArrayProperty;
    }
    else if(propertyName=="Number")
    {
        pro=new QIntProperty;
    }
    else if(propertyName=="Point")
    {
        pro=new QPointProperty;
    }
    else if(propertyName=="Size")
    {
        pro=new QSizeProperty;
    }
    else if(propertyName=="Rect")
    {
        pro=new QRectProperty;
    }
    else if(propertyName=="Bool")
    {
        pro=new QBoolProperty;
    }
    else if(propertyName=="Font")
    {
        pro=new QFontProperty;
    }
    else if(propertyName=="Cursor")
    {
        pro=new QCursorProperty;
    }
    else if(propertyName=="String")
    {
        pro=new QStringProperty;
    }
    else if(propertyName=="Enum")
    {
        pro=new QEnumProperty;
    }
    else if(propertyName=="Align")
    {
        pro=new QAlignmentProperty;
    }
    else if(propertyName=="Script")
    {
        pro=new QScriptProperty;
    }
    else if(propertyName=="Memery")
    {
        pro=new QMemeryDataProperty;
    }
    else if(propertyName=="Float")
    {
        pro=new QFloatProperty;
    }
    else if(propertyName=="Date")
    {
        pro=new QDateProperty;
    }
    else if(propertyName=="Time")
    {
        pro=new QTimeProperty;
    }
    else if(propertyName=="DateTime")
    {
        pro=new QDateTimeProperty;
    }
    else if(propertyName=="Name")
    {
        pro=new QNameProperty;
    }
    else if(propertyName=="Stylesheet")
    {
        pro=new QStylesheetProperty;
    }
    if(pro!=NULL)
    {
        pro->setAttribute("NeedSave",false);
        pro->setAttribute("type",propertyName);
        pro->setAttribute("plugin",pluginName());
    }

    return pro;
}

Q_EXPORT_PLUGIN2(QBasePropertyPlugin,QBasePropertyPlugin)
